<template>
	<div class="writeOff"> 
		<button type="primary" @click="goHome">返回首页</button>
	</div>
</template>

<script>
import { mapGetters } from 'vuex'
import { memberWriteOff } from '@/api/manageApi'
export default {
	data() {
		return {
      faceImg: '../static/f2.png',
      url: '',
      sid: ''
		}
	},
	computed: {
		...mapGetters(['userInfo', 'uniToken'])
	},
	onLoad(query) {
    this.url = decodeURIComponent(query.q) // 获取到二维码原始链接内
    var urlArr = this.url ? this.url.split('/') : []
    this.sid = urlArr[urlArr.length - 1]
    if (this.sid) {
      this.setOffAppointment(this.sid)
    }
	},
	methods: {
    goHome () {
      uni.reLaunch({
        url: '/pages/home/index',
      })
    },
		// 核销
    setOffAppointment (preOrderId) {
      // this.uShowModel('提示', '确定要核销吗', () => {
        var params = {
          id: preOrderId
        }
        memberWriteOff(params).then(res => {
          console.log(res)
          this.uShowToast(res.msg)
        })
      // })
    }
	}
}
</script>
<style lang="scss">
.writeOff{
  padding: 60rpx;
}
</style>
